package com.dzzw.Servlet.LMailBoxServlet;

import com.dzzw.Dao.LMailBoxDao;
import com.dzzw.Model.LMailBox;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/View/LMailBoxModifyServlet")
public class LMailBoxModifyServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;
    LMailBoxDao lMailBoxDao = new LMailBoxDao();
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        int lmail_id = Integer.parseInt(request.getParameter("lmail_id"));
        int leader_id = Integer.parseInt(request.getParameter("leader_id"));
        String leader_title = request.getParameter("leader_title");
        String leader_content = request.getParameter("leader_content");
        LMailBox lMailBox = new LMailBox();
        lMailBox.setLmail_id(lmail_id);
        lMailBox.setLeader_id(leader_id);
        lMailBox.setLeader_title(leader_title);
        lMailBox.setLeader_content(leader_content);
        lMailBoxDao.LMailBoxModify(lMailBox);
        response.sendRedirect("/View/SelectLMailBoxByEmployeeId.jsp");
    }
}
